﻿<html>
<head>
    <title>DM赠险导入</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!--<link rel="stylesheet" href="/life/main.css" type="text/css">-->
</head>
<!--<script language=javascript src="/life/public/js/CheckData.js"></script>-->
<!--<script language=javascript src="/life/public/js/Code.js"></script>-->
<!--<script src="../../js/newbiz_public_js.jsp"></script>-->
<!--<script language=javascript src="/life/public/js/CheckData.js"></script>-->

<!--<script language=javascript src="/life/public/js/Public.js"></script>-->

<script language=javascript src="../js/Code.js"></script>


<!--<script language=javascript src="/life/newbiz/entry/js/newbiz.js"></script>-->

<!--<script language=javascript src="/life/servlet/com.ebao.life.newbiz.util.JsServlet?js_type=newbiz_public"></script>-->
<SCRIPT LANGUAGE=javascript>
    function CheckBranchCodeExist() {
        if (form1.branch_code.value == "") {
            //alert('请先填写分行代码！');
            form1.branch_code.focus();
            return;
        }
    }
    //adeed by jooly.zhang 2005-02-23
    function getCheckNodeBankCode() {
        if (form1.vertifyBranchCode.value == "1") {

            if (form1.node_bank_code.value == null || form1.node_bank_code.value == "") {
                form1.node_bank_name.value = "";
                form1.agency_code.value = "";
                return 1;
            }

            try {

                form1.vertifyNoteBankCode.value = "1";//jooly.zhang

                var oXML = new ActiveXObject("Microsoft.XMLDOM");
                oXML.async = false;
                var url = "/life/servlet/com.ebao.life.newbiz.util.LoadXmlServlet?saction=BANK_BYCOMBINEDCODE&internal_code=" + form1.node_bank_code.value + "&branch_code=" + form1.branch_code.value;
                oXML.load(url);

                var currNode = oXML.documentElement.selectSingleNode("empty");

                if (currNode != null) {

                    if (currNode.text != 'false') {

                        form1.agency_code.value = "";

                        form1.node_bank_name.value = "";

                        form1.vertifyNoteBankCode.value = "0";//jooly.zhang

                        return 0;

                    }

                }

                currNode = oXML.documentElement.selectSingleNode("status");
                //alert(currNode.text);
                //return;
                if (currNode != null) {

                    if (currNode.text != "1") {

                        form1.vertifyNoteBankCode.value = "0";//jooly.zhang

                        return 0;

                    }

                }

                currNode = oXML.documentElement.selectSingleNode("bank_code");

                if (currNode != null) {

                    form1.agency_code.value = currNode.text;

                }

                currNode = oXML.documentElement.selectSingleNode("bank_name");

                if (currNode != null) {

                    form1.node_bank_name.value = currNode.text;

                }

                var cashNode = oXML.documentElement.selectSingleNode("manager_pay");

                currNode = oXML.documentElement.selectSingleNode("finance_pay");


                /*if (form1.type_code.value!="326") {

                 if (form1.sell_way.value=="0") {

                 if (cashNode.text!="")

                 form1.pay_mode_dis.value=cashNode.text;

                 } else if (form1.sell_way.value=="4" || form1.sell_way.value=="6") {

                 if (currNode.text!="")

                 form1.pay_mode_dis.value=currNode.text;

                 }
                 form1.pay_mode.value = form1.pay_mode_dis.value;

                 }*/

            } catch (e) {

                form1.vertifyNoteBankCode.value = "0";//jooly.zhang
                return 0;

            }

        }

        return 1;
    }
    //fxied by  jooly.zhang 2005-02-23
    function OnNodeBankCodeBlur() {

        if (form1.branch_code.value == "") {
            alert('请先填写分行代码！');
        }

        if (getCheckNodeBankCode() == "0") {

            alert('未找到该机构代码!');

            window.event.srcElement.focus();
        }
    }
    //add by  jooly.zhang 2005-02-23
    function getCheckEmpCode() {
        // when veritify branch ,and vertify note bank is right, or note bank is null,then check
        if (form1.vertifyBranchCode.value == "1" && (form1.vertifyNoteBankCode.value == "1"
                || (form1.node_bank_code.value == null || form1.node_bank_code.value == "") )) {

            if (form1.emp_internal_code == null || form1.emp_internal_code.value == null ||
                    form1.emp_internal_code.value == "") {

                form1.emp_name.value = "";
                form1.agency_hand.value = "";

                return 1;
            }

            try {

                var oXML = new ActiveXObject("Microsoft.XMLDOM");

                oXML.async = false;

                var url = "/life/servlet/com.ebao.life.newbiz.util.LoadXmlServlet?saction=EMP_BYCOMBINEDCODE&internal_code=" + form1.emp_internal_code.value + "&branch_code=" + form1.branch_code.value;

                oXML.load(url);

                var currNode = oXML.documentElement.selectSingleNode("empty");

                if (currNode != null) {
                    if (currNode.text != 'false') {

                        form1.agency_hand.value = "";
                        form1.emp_name.value = "";
                        return 0;
                    }
                }

                currNode = oXML.documentElement.selectSingleNode("id");

                if (currNode != null) {

                    form1.agency_hand.value = currNode.text;

                }

                currNode = oXML.documentElement.selectSingleNode("real_name");

                if (currNode != null) {

                    form1.emp_name.value = currNode.text;

                }

            } catch (e) {
                return 0;
            }
        }

        return 1;
    }
    //fxied by  jooly.zhang 2005-02-23
    function onEmpInternalCodeBlur() {

        if (form1.branch_code.value == "") {
            alert('请先填写分行代码！');
        }

        if (getCheckEmpCode() == "0") {

            alert('未找到经办人代码！');

            window.event.srcElement.focus();
        }
    }

    function CheckAgentCode() {

        try {

            var oXML = new ActiveXObject("Microsoft.XMLDOM");

            oXML.async = false;

            var url = "/life/servlet/com.ebao.life.newbiz.util.LoadXmlServlet?saction=CHECK_BANK_AGENT&internal_code="

                    + form1.node_bank_code.value + "&branch_code=" + form1.branch_code.value + "&agent_code="

                    + form1.agent_code.value + "&hold_date=" + form1.hold_date.value;

            oXML.load(url);

            var currNode = oXML.documentElement.selectSingleNode("exist");

            if (currNode != null) {

                if (currNode.text != 'true') {

                    if (!confirm('专管员代码和系统设定不一致，是否确认？')) {

                        form1.agent_code.focus();

                        form1.agent_code.select();

                        return;

                    }

                }

            }

        } catch (e) {

            window.alert("" + e.description);

            return;

        }

        return 1;

    }

    /*
     function OnBranchCodeBlur() {

     if (form1.branch_code.value=="") {

     form1.branch_code_desc.value = "";

     form1.node_bank_code.value = "";

     form1.node_bank_name.value = "";

     form1.agency_code.value = "";

     form1.emp_internal_code.value = "";

     form1.emp_name.value = "";

     form1.agency_hand.value = "";

     } else {

     form1.vertifyBranchCode.value = "1";//jooly.zhang

     try	{

     var oXML=new ActiveXObject("Microsoft.XMLDOM");

     oXML.async=false;

     var url="/life/servlet/com.ebao.life.newbiz.util.LoadXmlServlet?saction=CHECK_BRANCH_BANK&apply_code="+"000000000000326"+"&bank_code="+form1.branch_code.value;

     oXML.load(url);

     var currNode = oXML.documentElement.selectSingleNode("valid");

     if(currNode!=null){

     if (currNode.text!="true") {

     alert (oXML.documentElement.selectSingleNode("msg").text);

     window.event.srcElement.focus();

     form1.vertifyBranchCode.value = "0";//jooly.zhang
     return;

     }

     }

     currNode = oXML.documentElement.selectSingleNode("bank_name");

     if(currNode!=null){

     form1.branch_code_desc.value=currNode.text;

     }

     } catch (e) {

     form1.vertifyBranchCode.value = "0";//jooly.zhang

     window.alert (""+e.description);

     return;

     }

     }

     }*/

    //ר��Ա����¼��
    /*function beforeFillZero() {

     FillZero(11);

     }

     function FillZero(len) {

     if (window.event.srcElement.value !='')

     window.event.srcElement.value=fillZero(window.event.srcElement.value,len);

     }*/
    function CheckAgentCodeInfo(agent, agentDesc, policyType) {

        return ConfirmAgentCodeInfo(agent, agentDesc, policyType, false);

    }

    function ConfirmAgentCodeInfo(agent, agentDesc, policyType, isConfirm) {

        if (agent.value == "") {

            agentDesc.value = "";

            return;

        }

        beforeFillZero();
        var oXML = new ActiveXObject("Microsoft.XMLDOM");

        oXML.async = false;

        // oXML.load("/life/servlet/com.ebao.life.newbiz.util.LoadXmlServlet?saction=GET_AGENT_DATA&agent_code="+agent.value );
        var url = "/life/servlet/com.ebao.life.newbiz.util.LoadXmlServlet?saction=CHECK_AGENT_DATA&agent_code=" + agent.value + "&organ_id=" + form1.organ_id.value;
        oXML.load(url);


        try {

            var currNode = oXML.documentElement.selectSingleNode("empty");

            var empty = "false";

            if (currNode != null) {

                if (currNode.text == "true") empty = "true";

            } else {

                empty = "true";

            }

            if ("true" == empty) {

                alert('代码不存在');

                agent.focus();

                agent.select();

                return;

            }

            currNode = oXML.documentElement.selectSingleNode("organ_id");

            if (currNode != null) {

                if (currNode.text != form1.organ_id.value) {

                    if (isConfirm) {

                        if (!confirm('该业务员所属机构与投保单所属机构不一致')) {

                            agent.focus();

                            agent.select();

                            return;

                        }

                    } else {

                        alert('该业务员所属机构与投保单所属机构不一致');

                        agent.focus();

                        agent.select();

                        return;

                    }

                }

            }

            currNode = oXML.documentElement.selectSingleNode("status");

            if (currNode != null) {

                if (currNode.text == "2" || currNode.text == "") {

                    alert('该业务员已经离职');

                    agent.focus();

                    agent.select();

                    return;

                }

            }

            currNode = oXML.documentElement.selectSingleNode("real_name");

            if (currNode != null) {

                agentDesc.value = currNode.text;

            }

        } catch (e) {

            window.alert("" + e.description);

            return;

        }

        return 1;

    }

    function onBranchCodeBlur() {
        if (form1.branch_code.value == "") {
            form1.node_bank_code.value = "";
            form1.node_bank_name.value = ""
        }
        // add by honglin.chen 2006-8-14
        else {
            try {

                var oXML = new ActiveXObject("Microsoft.XMLDOM");
                oXML.async = false;
                var url = "/life/servlet/com.ebao.life.newbiz.util.LoadXmlServlet?saction=CHECK_BRANCH_CODE&branch_code=" + form1.branch_code.value + "&organ_id=" + form1.organ_id.value;
                oXML.load(url);
                var currNode = oXML.documentElement.selectSingleNode("empty");

                if (currNode != null) {

                    if (currNode.text == 'true') {
                        form1.branch_code.focus();
                        window.alert("输入的分行代码不在操作人的权限内，请确认后重新输入！! ");
                        return false;

                    }

                }

            } catch (e) {

//                window.alert("" + e.description);

                return;

            }

        }
    }

    function validation() {
        if (form1.branch_code.value == "") {
            form1.branch_code.focus();
            window.alert("请输入银行代码! ");
            return false;
        }
        if (form1.node_bank_code.value == "") {
            form1.node_bank_code.focus();
            window.alert("请输入银行网点项！! ");
            return false;
        }
        if (form1.agent_code.value == "") {
            form1.agent_code.focus();
            window.alert("请输入专管员代码! ");
            return false;
        }
        if (form1.emp_internal_code.value == "") {
            form1.emp_internal_code.focus();
            window.alert("请输入经办人! ");
            return false;
        }
        if (form1.policy_text.value == "") {
            form1.policy_text.focus();
            window.alert("请输入投保单文件! ");
            return false;
        }
        return true;
    }


    function OnBack() {
        window.location = "/life/main.jsp";
    }
    function uploadData() {
        if (validation()) {
            form1.action = "/life/WebAction/com.ebao.life.newbiz.application.dmimport.DmImportWebAction";
            form1.submit();
        }
    }

    function checkProcess() {
        form1.action = "/life/servlet/com.ebao.life.pub.backgroundcall.BackgroundCallServlet?process_id=55";
        form1.submit();
    }

</SCRIPT>

<body onload="form1.branch_code.focus()" bgcolor="#808080" leftmargin="0" topmargin="10" marginwidth="0"
      marginheight="0">

<form name=form1 ENCTYPE="multipart/form-data" method=post>
    <input type="hidden" name=agency_code value="">
    <input type="hidden" name=organ_id value="101">

    <input type="hidden" name="vertifyNoteBankCode" value="1"/>
    <input type="hidden" name="vertifyBranchCode" value="1"/>
    <table width="770" align="center" height="24" cellpadding="4" cellspacing="0" border="0">
        <tr>
            <td bgcolor="#444488"><font color="#FFFFFF" class="title01">DM赠险导入</font></td>
        </tr>
    </table>

    <table width="770" align="center" cellpadding="0" cellspacing="0" border="1" bgcolor="#cccccc"
           bordercolorlight="#000000" bordercolordark="#FFFFFF">
        <tr>
            <td>
                <table width="97%" border="1" cellspacing="0" cellpadding="4" bordercolor="#999999">
                    <tr>
                        <td>分行代码</td>
                        <td>
                            <input name='branch_code' id='branch_code' value='' size='8' maxlength='8' onblur="javascript:showDescFromServer('branch_code','branch_code_desc','T_BANK','代码不存在');onBranchCodeBlur()">
                            <!--<input name='branch_code' id='branch_code' value='' size='8' maxlength='8' onblur="javascript:showDescFromServer('branch_code','branch_code_desc','T_BANK','代码不存在')">-->
                            <input name='branch_code_desc' size='20' disabled value="">
                        </td>
                    </tr>
                    <tr>
                        <td>银行网点</td>
                        <td colspan=3>
                            <input type="text" class="textfiled" name="node_bank_code" value=""
                                   onFocus="CheckBranchCodeExist()" onblur="OnNodeBankCodeBlur()" size="14"
                                   maxlength="20" tabindex=3>
                            <input type="text" class="textfiled" name="node_bank_name" value="" size="30" disabled>
                        </td>
                    </tr>
                    <tr>
                        <td width="13%">专管员代码</td>
                        <td width="45%">
                            <input type="text" class="textfiled" name="agent_code"
                                   onblur="CheckAgentCodeInfo(this,form1.agent_code_desc,'3');" size="10" tabindex=3
                                   value="" maxLength="20">

                            <input type="text" class="textfiled" name='agent_code_desc' size='12' disabled value=''>

                        </td>
                    </tr>
                    <tr>
                        <td>经办人</td>
                        <td colspan="3">
                            <input type="text" class="textfiled" name="emp_internal_code" value=""
                                   onFocus="CheckBranchCodeExist();" onblur="onEmpInternalCodeBlur()" size="14"
                                   maxlength=20 tabindex=3>
                            <input type="text" class="textfiled" name="emp_name" value="" size="30" disabled>
                            <input type="hidden" name=agency_hand value="">
                        </td>
                    </tr>
                    <tr>
                        <td width="17%">选择文件</td>
                        <td><input type="file" name="policy_text" size="40"></td>
                    </tr>
                </table>
                <table align=center>
                    <tr>
                        <td><br><br>
                            <input type="button" name="SubmitSearch" value="后台任务查询" onclick="checkProcess()">&nbsp;&nbsp;&nbsp;
                            <input type="button" name="Submit223" value="数据上载" onclick="uploadData()">&nbsp;&nbsp;&nbsp;
                            <input type="button" name="back" value="退出" onClick="OnBack()">
                            <br>
                        </td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td>&nbsp;</td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</form>
</body>
</html>
